import Menufilter from './menufilter'
import router from '../router'

const addRoutes = {
  state: {
    routeData: []
  },
  mutations: {
    addFn(state, addrouter) {
      let routes = []

      Menufilter(routes, addrouter) // 将后台的路由数据components转化成组件
      console.log(222, routes)
      router.addRoutes(routes)  // 添加路由

      router.push('/')
    }
  },
  actions: {
    add_Routes(context, addrouter) {
      context.commit('addFn', addrouter)
    }
  }
}

export default addRoutes